package fr.nts.framework.core.test.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import fr.nts.framework.core.task.SimpleTask;

public class ExempleTask implements SimpleTask<Integer>{

	private Integer result;
	
	private static final Logger log = LoggerFactory.getLogger(ExempleTask.class);
	 
	public ExempleTask(){
		log.debug("Construction de la tâche" + toString());
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run(){
		log.info("La tâche " + toString() + " démarre.");
		setResult(33);
		log.info("La tâche " + toString() + " est finie.");
		try{
			Thread.sleep(500);
		}catch(InterruptedException e){
			
		}
	}

	
	/*
	 * (non-Javadoc)
	 * @see fr.nts.framework.core.task.NTSTask#getResult()
	 */
	@Override
	public Integer getResult(){
		log.debug("Résultat de la tâche" + toString());
		return result;
	}

	// GETTER / SETTER
	public void setResult(Integer result){
		this.result = result;
	}
}